import 'package:dio/dio.dart';

class ApiService {
  final Dio _dio = Dio();

  Future<Map<String, dynamic>> getInfoByIsbn(String isbn, String appKey) async {
    try {
      final response = await _dio.get(
          'http://api.demo.com/getInfoByIsbn',
          queryParameters: {'isbn': isbn, 'appKey': appKey});

      if (response.statusCode == 200) {
        return response.data['data'];
      } else {
        throw Exception('Failed to load data');
      }
    } catch (e) {
      throw Exception('Failed to load data');
    }
  }
}